# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Veeti Paananen <veeti.paananen@rojekti.fi>

pkgname=cmark
pkgver=0.30.3
pkgrel=1
pkgdesc='CommonMark parsing and rendering library and program in C'
arch=(x86_64)
url='https://github.com/commonmark/cmark'
license=('custom:BSD2')
depends=(glibc)
makedepends=(cmake python)
source=(https://github.com/commonmark/cmark/archive/$pkgver/$pkgname-$pkgver.tar.gz)
sha512sums=('27383bfef95ae1390c26aff0dd2cbca33704e7d20116bf29da4695d2c9a4146b86daba0da1e91bdb9eab95671702f885e832b3d31d51601731f1dc630df5237b')

build() {
  cmake -B build -S $pkgname-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMARK_STATIC=OFF
  cmake --build build
}

check() {
  cmake --build build --target test
}

package() {
  DESTDIR="$pkgdir" cmake --install build

  install -Dm 644 $pkgname-$pkgver/COPYING -t "$pkgdir"/usr/share/licenses/$pkgname
}
